<!-- This is to display the user's friends who have bet on a match (via the "X no. of friends have bet" link). This also includes placing challenges on those friends -->
<%match = Match.find(sid)%>
<%match_placed =  (user||current_user).bets.map{|b| b.match_id}.include?(sid.to_i)%>
<table>
	<tr style="vertical-align:top;">
		<td style="border:none">
			<div style="width:245px;">
				<center><span class="boldfont"><%=Match.find(sid).home_team.displayed_name%></span></center>
				<table width="100%">
					<%@home_friends.each_with_index do |u,i|%>
						<tr>
							<td width="25%" style="border:none;vertical-align:middle;padding:4px;height:83px;">
								<%if i > 1 and !match_placed%>
									<%=image_tag"mystery-person.gif"%>
								<%else%>
								    <fb:profile-pic uid=<%=u.id%> size="square"/>
								<%end%>
							</td>
							<td width="75%" style="border:none;">
								<%if i > 1 and !match_placed%>
								    Place bet to find out<br/>who is this friend
								<%else%>
								    <%res = user.challenge_status(u,sid)%>
									<%= render :partial=>res[:status],:locals=>{:u=>u,:sid=>sid,:ch=>res[:ch]}%>
								<%end%>
							</td>
						</tr>
					<%end%>
				</table>
			 </div>
		</td>
		<td style="border-left:1px #ccc solid;border-top:none;border-bottom:none;border-right:none">
			<div style="width:245px;">
				<center><span class="boldfont"><%=Match.find(sid).away_team.displayed_name%></span></center>
				<table width="100%">
					<%@away_friends.each_with_index do |u,i|%>
						<tr>
							<td width="25%" style="border:none;vertical-align:middle;padding:4px;height:83px;">
								<%if i > 1 and !match_placed%>
									<%=image_tag"mystery-person.gif"%>
								<%else%>
								   <fb:profile-pic uid=<%=u.id%> size="square"/>
								<%end%>
							</td>
							<td width="75%" style="border:none;">
								<%if i > 1 and !match_placed%>
									Place bet to find out<br/>who this friend is
								<%else%>
									<%res = user.challenge_status(u,sid)%>
									<%= render :partial=>res[:status],:locals=>{:u=>u,:sid=>sid,:ch=>res[:ch]}%>
								<%end%>
							</td>
						</tr>
					<%end%>
				</table>
			 </div>
		</td>
	</tr>
	<tr>
		<td colspan=2 style="border:none;">
			<%=render :partial=>'place_ch_link',:locals=>{:sid=>sid,:u=>nil}%>
		</td> 
	</tr>
</table>
